package com.itheima.demo;

import com.itheima.dao.UserDao;
import com.itheima.domain.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Demo {
    public static void main(String[] args) {
        //UserDao userDao = new UserDaoImpl();
        //创建spring IOC 容器
        ApplicationContext ac = new ClassPathXmlApplicationContext("spring.xml");

        //从IOC容器中获取bean对象
        UserDao userDao = (UserDao) ac.getBean("userDao");
        userDao.say();

        User user = (User) ac.getBean("user");
        user.testUser();
    }
}
